DNM: psci-mfd driver for review#389
DNM: psci-mfd driver for review#389quicAspratap wants to merge 3 commits intoqualcomm-linux:mainfrom
Conversation
PSCI supports different types of resets like COLD reset, ARCH WARM reset, vendor-specific resets. Currently there is no common driver that handles all supported psci resets at one place. Additionally, there is no common mechanism to issue the supported psci resets from userspace. Add a PSCI reboot mode driver and define two types of PSCI resets in the driver as reboot-modes: predefined resets controlled by Linux reboot_mode and customizable resets defined by SoC vendors in their device tree under the psci:reboot-mode node. Register the driver with the reboot-mode framework to interface these resets to userspace. When userspace initiates a supported command, pass the reset arguments to the PSCI driver to enable command-based reset. This change allows userspace to issue supported PSCI reset commands using the standard reboot system calls while enabling SoC vendors to define their specific resets for PSCI. Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Add a new PSCI MFD driver that binds to arm,psci-1.0 and registers cpuidle-psci-domain as a child cell. Since cpuidle-psci-domain now probes without its own of_node, use the parent PSCI of_node to traverse the power domain. Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Add a psci-reboot-mode cell to the psci-mfd driver and bind the psci:reboot-mode node to it. Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
|
|
||
| ret = devm_reboot_mode_register(&pdev->dev, reboot); | ||
| if (ret) { | ||
| dev_err_probe(&pdev->dev, ret, "devm_reboot_mode_register failed %d\n", ret); |
| { | ||
| struct reboot_mode_driver *reboot; | ||
| int ret; | ||
|
|
There was a problem hiding this comment.
Add struct device *dev = &pdev->dev; for brevity
| .name = "psci-reboot-mode", | ||
| }, | ||
| }; | ||
|
|
|
|
||
| pr_err("DEBUG: PSCI write called"); | ||
| pr_err("DEBUG: PSCI write called"); | ||
| pr_err("DEBUG: PSCI write called"); |
| * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
| */ | ||
|
|
||
| #include <linux/device/faux.h> |
| #include <linux/device/faux.h> | ||
| #include <linux/device.h> | ||
| #include <linux/err.h> | ||
| #include <linux/of.h> |
There was a problem hiding this comment.
You don't seem to be using this nor err.h
| select REBOOT_MODE | ||
| help | ||
| Say y here will enable PSCI reboot mode driver. This gets | ||
| the PSCI reboot mode arguments and passes them to psci |
brgl
left a comment
There was a problem hiding this comment.
I would move this commit to the back of the series so that it comes after the commit converting the existing driver to MFD
| { | ||
| return platform_driver_register(&psci_mfd_driver); | ||
| } | ||
|
|
| depends on ARM_PSCI_CPUIDLE | ||
| depends on PM_GENERIC_DOMAINS_OF | ||
| select DT_IDLE_GENPD | ||
| select MFD_PSCI |
| static int psci_cpuidle_domain_probe(struct platform_device *pdev) | ||
| { | ||
| struct device_node *np = pdev->dev.of_node; | ||
| struct device_node *np = pdev->dev.parent->of_node; |
There was a problem hiding this comment.
This file should drop its of_device_id table in favor of being probed by the MFD parent exclusively.
drivers/mfd/psci-mfd.c
Outdated
|
|
||
| static int psci_mfd_probe(struct platform_device *pdev) | ||
| { | ||
| return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, psci_cells, |
There was a problem hiding this comment.
This should have been devm_mfd_add_devices() from the start.
| if (ret) | ||
| goto out; | ||
|
|
||
| psci_mfd_bind_reboot_mode_node(pdev); |
There was a problem hiding this comment.
This is racy, the sub-device could have already been probed at this time after devm_mfd_add_devices(). Maybe we need a compatible in the reboot-mode node after all. This would make it much easier with the of_compatible field of struct mfd_cell. Has there ever been a push back against it?
Creating this pull request just for review of changes. This is DNM.